import { onBeforeUnmount } from "vue";
import { _layoutStore } from "@/store/config";

const useLoading = () => {
    const showLoading = () => {
        _layoutStore.routerViewLoading = true;
    };
    const hideLoading = () => {
        _layoutStore.routerViewLoading = false;
    };
    onBeforeUnmount(() => {
        hideLoading();
    });
    return { showLoading, hideLoading };
};

export default useLoading;
